package com.xsp.mybatisxmlsqlparser.replacer;

import org.springframework.stereotype.Component;

@Component
public class MybatisMapperXMLReplacer {
    public String replace(String sql) {
        return sql.replaceAll("#\\{[^}]*}", " ? ");
    }

    public String whereTagPlaceholder() {
        return " WHERE 1=1 ";
    }

    public String whereEndTagPlaceholder() {
        return " AND 1=1 ";
    }

    public String ifStartTagPlaceholder(int index) {
        return " AND @IFSTART" + index;
    }

    public String ifEndTagPlaceholder(int index) {
        return " AND @IFEND" + index;
    }

    public String forEachPlaceholder(int index) {
        return " @FOREACH" + index;
    }
}
